local leiji = fk.CreateSkill{
    name = "SP_heg__leiji",
}

Fk:loadTranslationTable{
  ["SP_heg__leiji"] = "雷击",
  [":SP_heg__leiji"] = "当你使用或打出【闪】时，你可以令一名其他角色进行一次判定，若结果为：♠，你对其造成2点雷电伤害。",
  ["#SP_heg__leiji-choose"] = "雷击：令一名角色进行判定，若为♠，你对其造成2点雷电伤害。",

  ["$SP_heg__leiji"] = "阳气施化，阴气结成，成化相合。",
}


local leiji_spec = {
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(leiji.name) and target == player and data.card.name == "jink"
    end,
    on_cost = function(self, event, target, player, data)
      local room = player.room
      local to = room:askToChoosePlayers(player, {
        min_num = 1,
        max_num = 1,
        targets = room.alive_players,
        skill_name = leiji.name,
        prompt = "#SP_heg__leiji-choose",
        cancelable = true,
      })
      if #to > 0 then
        event:setCostData(self, {tos = to})
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local to = event:getCostData(self).tos[1]
      local judge = {
        who = to,
        reason = leiji.name,
        pattern = ".|.|spade",
      }
      room:judge(judge)
      if judge.card.suit == Card.Spade and not to.dead then
        room:damage{
          from = player,
          to = to,
          damage = 2,
          damageType = fk.ThunderDamage,
          skillName = leiji.name,
        }
      end
    end,
  }

leiji:addEffect(fk.CardUsing, leiji_spec)
leiji:addEffect(fk.CardResponding, leiji_spec)

return leiji